Skip to content

firmware_uefi: emit telemetry for secureboot compliance#3966

Open
maheeraeron wants to merge 12 commits into
microsoft:mainfrom
maheeraeron:user/maheeraeron/sb-template-compliance-clean
Open

firmware_uefi: emit telemetry for secureboot compliance#3966
maheeraeron wants to merge 12 commits into
microsoft:mainfrom
maheeraeron:user/maheeraeron/sb-template-compliance-clean

Conversation

@maheeraeron

Copy link
Copy Markdown
Contributor

Per AzSec ask, emit telemetry evaluating whether a secure boot variable in NVRAM contains the base secure boot template signatures.

Copilot AI review requested due to automatic review settings July 17, 2026 21:36
@maheeraeron
maheeraeron requested a review from a team as a code owner July 17, 2026 21:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds secure-boot compliance telemetry by comparing loaded NVRAM Secure Boot variables (PK/KEK/db/dbx) against a “base template” signature set, plumbing the base-template variables through the UEFI config path and triggering a post-injection callback to emit telemetry.

Changes:

  • Add base_secure_boot_template_vars alongside custom_uefi_vars across OpenVMM config/manifest plumbing so the UEFI device can evaluate “base template presence”.
  • Add an NvramStorage::after_custom_vars_injected() hook and call it on first boot after custom vars injection (when secure boot is enabled).
  • Implement signature-list parsing and telemetry emission in hcl_compat_uefi_nvram_storage, plus unit tests and new deps.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
vmm_core/vm_manifest_builder/src/lib.rs Adds base_secure_boot_template_vars to UefiManifest::new and stores it in UefiConfig.
vm/devices/firmware/uefi_nvram_storage/src/lib.rs Extends NvramStorage with after_custom_vars_injected() and forwards through trait objects.
vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs Adds base-template tracking, signature parsing, and telemetry reporting for secure boot vars.
vm/devices/firmware/hcl_compat_uefi_nvram_storage/Cargo.toml Adds uefi_nvram_specvars and uefi_specs dependencies.
vm/devices/firmware/firmware_uefi/src/service/nvram/spec_services/mod.rs Exposes after_custom_vars_injected() passthrough on spec services.
vm/devices/firmware/firmware_uefi/src/service/nvram/mod.rs Calls the new hook after injecting custom vars on first boot (secure boot enabled).
vm/devices/firmware/firmware_uefi/src/resolver.rs Builds BaseSecureBootTemplateVariables from template vars and attaches them to the NVRAM backend.
vm/devices/firmware/firmware_uefi_resources/src/lib.rs Adds base_secure_boot_template_vars field to UefiConfig (Protobuf).
petri/src/vm/openvmm/construct.rs Plumbs base template vars separately from the final custom vars in Petri VM construction.
openvmm/openvmm_entry/src/ttrpc/mod.rs Initializes new config field to default in the ttrpc path.
openvmm/openvmm_entry/src/lib.rs Splits base-template vars from final custom vars and passes both into manifest/config.
openvmm/openvmm_defs/src/config.rs Adds base_secure_boot_template_vars to the worker Config (MeshPayload).
openvmm/openvmm_core/src/worker/dispatch.rs Plumbs new config field into internal Manifest (MeshPayload) and defaults in TODO path.
openhcl/underhill_core/src/worker.rs Adds base_secure_boot_template_vars into firmware_uefi_resources::UefiConfig construction.
Cargo.lock Records new dependency usage in the lockfile.

Comment thread vm/devices/firmware/firmware_uefi_resources/src/lib.rs
Comment thread openvmm/openvmm_defs/src/config.rs
Comment thread openvmm/openvmm_core/src/worker/dispatch.rs
Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
@github-actions

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 21, 2026 20:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.

Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
@github-actions

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 21, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Comment thread vm/devices/firmware/uefi_nvram_storage/src/lib.rs Outdated
Comment thread vm/devices/firmware/firmware_uefi/src/service/nvram/spec_services/mod.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 22:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 21, 2026 23:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
@github-actions

Copy link
Copy Markdown

@smalis-msft smalis-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a pretty wide-reaching change to just add some telemetry. Is all this wiring really needed?

@maheeraeron

maheeraeron commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

This feels like a pretty wide-reaching change to just add some telemetry. Is all this wiring really needed?

Not really, we're still ping-ponging back and forth with AzSec to clarify what contexts they need given that we cannot predict every customer's custom uefi json injection intent.

I'm now looking to trim the plumbing, but we do need a lot of the plumbing to add in a base_secure_boot_template_vars

EDIT: I am thinking we can remove plumbing of the baseline revision string and the customization mode enum. Instead, we'd rather have AzSec derive the intent from the facts openhcl can determine rather than doing work to infer

Comment thread openvmm/openvmm_core/src/worker/dispatch.rs Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 20:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs:58

  • SignatureSet only keys on (EFI_SIGNATURE_DATA, bytes) (signature owner + payload) and does not include the EFI_SIGNATURE_LIST.signature_type. That can conflate X509 and SHA256 entries if the same owner/payload bytes appear under different signature types, producing incorrect “baseline present/missing” counts. Include the signature_type GUID in the set key so entries are compared with the same semantics as the UEFI signature database.
type SignatureSet = BTreeSet<(EFI_SIGNATURE_DATA, Vec<u8>)>;

Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs
Copilot AI review requested due to automatic review settings July 22, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Comment thread vm/devices/firmware/firmware_uefi_custom_vars/src/lib.rs Outdated
@github-actions

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 22, 2026 22:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs:761

  • This unit test asserts that signature comparison ignores signature_owner, but earlier review discussion for this PR indicated we should require full signature equality (including owner). If the intended semantics are owner-sensitive (to avoid false compliance), this test should be inverted (and renamed) so it fails unless the implementation includes signature_owner in the comparison key.
    fn secure_boot_template_comparison_ignores_signature_owner() {
        let baseline = signature_set(&x509_variable(TEST_OWNER, &[b"cert1"]));
        let loaded = signature_set(&x509_variable(Guid::new_random(), &[b"cert1"]));

        assert_eq!(baseline, loaded);

Comment thread vm/devices/firmware/hcl_compat_uefi_nvram_storage/src/lib.rs Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 23:23
/// Revision of the Secure Boot baseline represented by the built-in templates.
/// Update this value when the built-in templates are updated to a new baseline.
/// TODO: Should we change our baseline identifier?
pub const BASELINE_REVISION: &str = "July 2026";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if this is what we want to claim as our baseline revision or something else. Do we have existing names for terms or some kind of way to identify whenever we make template updates?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 22, 2026 23:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants